package org.base.baseproject.service.impl;

import org.base.baseproject.utils.MD5Utils;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * 密码加密器
 */
public class UserMD5PasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return MD5Utils.MD5Upper(rawPassword.toString());
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(MD5Utils.MD5Upper(rawPassword.toString()));
    }
}
